package com.ssy.lingxi.platform.manage.entity.content;

import com.ssy.lingxi.platform.manage.handler.convert.JpaJsonToLongListConverter;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 资讯实体类
 * @author fhj
 * @version 2.0.0
 * @date 2020/9/21
 */
@Data
@Entity
@Table(schema = "public", name = "man_content_information")
public class ContentInformation implements Serializable {
    private static final long serialVersionUID = 7748328159274466972L;

    @ApiModelProperty(value = "主键id")
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "content_information_seq")
    @SequenceGenerator(sequenceName = "man_content_information_seq", name = "content_information_seq", allocationSize = 1)
    private Long id;

    @ApiModelProperty(value = "标题")
    @Column(columnDefinition = "varchar(60)")
    private String title;

    @ApiModelProperty(value = "栏目ID")
    private Long columnId;

    @ApiModelProperty(value = "推荐标签 1-头条文章 2-轮播新闻 3-图片新闻 4-推荐阅读 5-行情推荐 6-本栏推荐")
    private Integer recommendLabel;

    @ApiModelProperty(value = "排序")
    private Integer sort;

    @ApiModelProperty(value = "浏览数")
    private Integer readCount;

    @ApiModelProperty(value = "一级分类ID")
    private Long firstCategoryId;

    @ApiModelProperty(value = "二级分类ID")
    private Long secondCategoryId;

    @ApiModelProperty(value = "三级分类ID")
    private Long thirdlyCategoryId;

    @ApiModelProperty(value = "一级分类名称")
    private String firstCategoryName;

    @ApiModelProperty(value = "二级分类名称")
    private String secondCategoryName;

    @ApiModelProperty(value = "三级分类名称")
    private String thirdlyCategoryName;

    @Convert(converter = JpaJsonToLongListConverter.class)
    @Column(columnDefinition = "jsonb")
    @ApiModelProperty(value = "标签ID集合")
    private List<Long> labelIds = new ArrayList<>();

    @ApiModelProperty(value = "图片地址")
    private String imageUrl;

    @ApiModelProperty(value = "摘要")
    @Column(columnDefinition = "varchar(300)")
    private String digest;

    @ApiModelProperty(value = "内容")
    @Column(columnDefinition = "text")
    private String content;

    @ApiModelProperty(value = "状态 1-待上架 2-已上架 3-已下架")
    private Integer status = 1;

    @ApiModelProperty(value = "收藏数")
    private Integer collectCount = 0;

    @ApiModelProperty(value = "创建时间")
    private Long createTime = System.currentTimeMillis();
}
